
    /**  
    * @Title: WSGatewayConfig.java
    * @Package com.efast.cafe.commponent.es.webservice.configuration
    * @Description: TODO(用一句话描述该文件做什么)
    * @author Administrator
    * @date 2018年9月18日
    * @version V1.0  
    */
    
package com.efast.cafe.commponent.es.webservice.configuration;

import org.apache.cxf.Bus;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;

import com.efast.cafe.commponent.es.webservice.IWSGatewayService;
import com.efast.cafe.commponent.es.webservice.interceptor.WSGatewayServiceInterceptor;


/**
    * @ClassName: WSGatewayConfig
    * @Description: 加载cxf配置
    * @author Administrator
    * @date 2018年9月18日
    *
    */
@ConditionalOnProperty(
        name="cxf.enable",
        havingValue="true"
)
@Configuration
public class WSGatewayConfig {


  @Autowired
  private Bus bus;
  @Autowired
  private IWSGatewayService wSGatewayService;
  
 

  @Bean
  public Endpoint endpoint() {
	  EndpointImpl endpoint=new EndpointImpl(bus, wSGatewayService);
	  endpoint.publish("/doWSService"); //显示要发布的名称
	  endpoint.getInInterceptors().add(new LoggingInInterceptor());
	  endpoint.getInInterceptors().add(new WSGatewayServiceInterceptor());
	  GZIPOutInterceptor gzipOut = new GZIPOutInterceptor(1024);
	  endpoint.getOutInterceptors().add(gzipOut);
	  endpoint.getOutInterceptors().add(new LoggingOutInterceptor());
	  
	  return endpoint;
  }
  @Bean
  public InitWebServiceConfig initWebServiceConfig(){
	  return new InitWebServiceConfig();
  }
}
